package com.cybertron.am.wordpress.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cybertron.am.wordpress.Constants;
import com.cybertron.am.wordpress.type.JsonTypeHandler;
import lombok.*;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = Constants.TABLE_NAME_PREFIX + "crawl_product", autoResultMap = true)
@EqualsAndHashCode(callSuper = false)
public class CrawlProduct {

    @TableId(value = "id", type = IdType.INPUT)
    private String id;
    private String url;
    private String seedId;
    private String categoryId;
    private String title;
    private String brand;
    private String description;
    private String price;
    @TableField(typeHandler = JsonTypeHandler.class)
    private String[] images;
    @TableField(typeHandler = JsonTypeHandler.class)
    private String[] options;
    @TableField(typeHandler = JsonTypeHandler.class)
    private CrawlVariant[] variants;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    @EqualsAndHashCode(callSuper = false)
    public static class CrawlVariant {

        private String title;
        private String price;
        private String image;
        private String[] options;
    }
}
